﻿using Logic.Global;
using UnityEngine;

namespace Model
{
    public static class UserDataModel
    {
        public static void OnInit()
        {
            EnterGameNumber++;
            if (string.IsNullOrEmpty(FirstEnterGameVersion))
            {
                FirstEnterGameVersion = AppConst.CurVersion;
            }
        }

        /// 是否为首次进入App
        public static bool IsFirstEnterApp => EnterGameNumber == 1;

        /// 累计进入游戏的次数
        public static int EnterGameNumber
        {
            get => PlayerPrefs.GetInt("EnterGameNumber", 0);
            set => PlayerPrefs.SetInt("EnterGameNumber", value);
        }

        /// 首次进入游戏时的版本
        public static string FirstEnterGameVersion
        {
            get => PlayerPrefs.GetString("FirstEnterGameVersion", "");
            set => PlayerPrefs.SetString("FirstEnterGameVersion", value);
        }
    }
}